@(processTaskForm: Form[models.production.TaskSpec], attributes: List[core.BaseAttrSpec])

@import helper._

@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.render) }

@main {

<script type="text/javascript">
    function addAttribute(value){
        //alert();
        var option = $("#attributeSelectId option[value="+value+"]")
        $('#attDesc').text($('#attDesc').text() + "," + option.text() );
        //alert(value + ':' + $(option).text());
        $('#attIds').val($('#attIds').val() + "," + value );
    }

</script>

<h1>Thêm khâu sản xuất</h1>

@form(routes.ProcessTaskController.save()) {
<fieldset>

    @inputText(processTaskForm("name"), '_label -> "Tên khâu")
    @inputText(processTaskForm("descripton"), '_label -> "Mô tả")
    <div class="clearfix" id="atts">
        <label for="attDesc">Thuộc tính</label>
        <div class="input" >
                <label id="attDesc" style="text-align: left" >
                    @for(attribute <- attributes){
                        attribute.name
                    }
                    </label>

        </div>
    </div>
    <input type="hidden" id="attids" name="attids">
    <div class="clearfix">
        <label for="attributeSelectId">Chọn thuộc tính</label>
        <div class="input" >
            <select id="attributeSelectId" onchange="javascript:addAttribute(this.value);">
                <option value="-1">----Chọn thuộc tính-----</option>
                @for(attribute<-core.BaseAttrSpec.attibutes){
                <option onmouseup="" value="@attribute.id">@attribute.name</option>
                }

            </select>
        </div>
    </div>


</fieldset>

<div class="actions">
    <input type="submit" value="Lưu" class="btn primary">
    <a href="@routes.ProcessTaskController.list()" class="btn">Hủy</a>
</div>

}

}